<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui"
     template="../../Template.xhtml"
>
<ui:define name="title">Edit category</ui:define>

<ui:define name="body">

<h:form>
	<p:panelGrid columns="2">
<h2>Edi City</h2>
<p:commandButton value="Back" action="ManageCity.xhtml" />
</p:panelGrid>
</h:form>
<br/><br/><br/><br/>
<h:form>

<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />

	<p:panelGrid columns="3">
	  <p:outputLabel value="Select Country :" />
	 
	   <p:selectOneMenu id="country" value="#{cityMB.idC}" style="width:150px">
                <p:ajax listener="#{cityMB.onCountryChange()}" update="State" />
                <f:selectItem itemLabel="Select Country" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{cityMB.listPays}" var="a" itemValue="#{a.idPays}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
	  <br/>
	  <p:outputLabel value="Select State :" />
	  <p:selectOneMenu id="State" value="#{cityMB.idS}" style="width:150px"  required="true" requiredMessage="State is required">
                <f:selectItem itemLabel="Select State" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{cityMB.listeEtat}"  var="s" itemValue="#{s.idEtat}"  itemLabel="#{s.intitule}"/>
            </p:selectOneMenu><br/>
		<p:outputLabel value="city Name :"/>
		<p:inputText id="intitule" value="#{cityMB.ville.intitule}" required="true" requiredMessage="city name is required" />
		<p:message for="intitule" />
		<p:outputLabel value="Status :" />
		<p:selectOneMenu value="#{cityMB.ville.statut}" >
			<f:selectItem  itemValue="true" itemLabel="Active"  />
			<f:selectItem  itemValue="false" itemLabel="Inactive"  />
		</p:selectOneMenu><br/>
		<p:commandButton action="#{cityMB.Ajouter}" value="Update" ></p:commandButton>
	</p:panelGrid>
</h:form>
	
</ui:define>
</ui:composition>